package cn.livingCloud.dto;

import cn.livingCloud.entity.content.Article;
import cn.livingCloud.entity.user.User;
import cn.livingCloud.utils.DateUtils;

/**
 * Created by DingJie  on 2016/1/15.
 */
public class ArticleDto {

    private String uuid;
    //文章标题
    private String title;
    //标题颜色
    private String color;
    //是否加粗
    private boolean strong;
    //内容
    private String content;
    //是否发布
    private boolean publish;
    //创建日期
    private String createTime;
    //最后修改日期
    private String lastModifyTime;
    //创建人
    private UserDto creater;
    private String userId;

    public ArticleDto() {
    }

    public ArticleDto(Article article) {
        this.uuid = article.getUuid();
        this.title = article.getTitle();
        this.color = article.getColor();
        this.content = article.getContent();
        this.publish = article.isPublish();
        this.createTime = DateUtils.toDateText(article.getCreateTime()
                , DateUtils.DEFAULT_DATE_TIME_FORMAT);
        this.lastModifyTime = DateUtils.toDateText(article.getLastModifyTime()
                , DateUtils.DEFAULT_DATE_TIME_FORMAT);
        User user = article.getCreater();
        if (user != null) {
            this.creater = new UserDto(user);
        }
        this.strong = article.isStrong();
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public boolean isStrong() {
        return strong;
    }

    public void setStrong(boolean strong) {
        this.strong = strong;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public boolean isPublish() {
        return publish;
    }

    public void setPublish(boolean publish) {
        this.publish = publish;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getLastModifyTime() {
        return lastModifyTime;
    }

    public void setLastModifyTime(String lastModifyTime) {
        this.lastModifyTime = lastModifyTime;
    }

    public UserDto getCreater() {
        return creater;
    }

    public void setCreater(UserDto creater) {
        this.creater = creater;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }
}
